package models

type GSetting struct {
	Id    int    `xorm:"int pk autoincr"`
	Code  string `xorm:"varchar(32) notnull"`
	Key   string `xorm:"varchar(64) notnull"`
	Value string `xorm:"varchar(4096) notnull default '' "`
}

//type Slack struct {
//	Url      string    `json:"url"`
//	Channels []Channel `json:"channels"`
//	Template string    `json:"template"`
//}

func (setting *GSetting) KeyCodeExists(code, key string) (bool, error) {
	//if id == 0 {
	//	count, err := Db.Where("name = ?", name).Count(host)
	//	return count > 0, err
	//}

	count, err := Db.Where("Code = ? AND Key = ?", code, key).Count(setting)
	return count > 0, err
}
